﻿@model GPS.ENTITYS.ViewModelDSH
@using PagedList.Mvc;
@using GPS.Helpers;
@{
    ViewBag.Title = "Sát hạch";
}

<script src="~/Scripts/jquery.validate.min.js"></script>
<script src="~/Scripts/jquery.validate.unobtrusive.min.js"></script>

<script src="~/Scripts/jquery.maskedinput.js"></script>
<script src="~/Scripts/datepicker.js"></script>



<div class="container fdb-div-content fdb-div-corner-all">
    <h3 class="text-center fdb-title-search-form">Thông tin kỳ sát hạch</h3>

    @using (Html.BeginForm("Index", "GPS_SatHach", FormMethod.Get))
    {
        <a href="#" class="show_hide">Hiển thị khung tìm kiếm</a>
        <div class="criteria_search">
            <br />
            <div class="row">
                <div class="col-md-2 control-label">
                   Mã sát hạch
                </div>
                <div class="col-md-4">
                    @Html.TextBoxFor(model => model.pSH_MA, new { @class = "form-control" })
                </div>
                <div class="col-md-2 control-label">
                    Số quyết định sát hạch
                </div>
                <div class="col-md-4">
                    @Html.TextBoxFor(model => model.pSH_SOQD, new { @class = "form-control" })
                </div>
            </div>

            <div class="row margin-top-05">
                <div class="col-md-2 control-label">
                    Đơn vị GTVT
                </div>
                <div class="col-md-4">
                    @Html.DropDownListFor(model => model.pSH_DVGTVT_MA, (SelectList)ViewBag.pSH_DVGTVT_MAs, string.Empty, new { @class = "form-control", @id = "pSH_DVGTVT_MA_dll" })
                </div>
                <div class="col-md-2 control-label">
                 
                </div>
                <div class="col-md-4">
                   
                </div>
            </div>
            <div class="row margin-top-05">
                <div class="col-md-2 control-label">
                    Ngày sát hạch từ
                </div>
                <div class="col-md-4">

                    @Html.TextBoxFor(model => model.pSH_NGAY_TU, "{0:dd/MM/yyyy}", new { @class = "form-control", @style = "width:120px" })
                </div>

                <div class="col-md-2 control-label">
                    Đến
                </div>
                <div class="col-md-4">
                    @Html.TextBoxFor(model => model.pSH_NGAY_DEN, "{0:dd/MM/yyyy}", new { @class = "form-control", @style = "width:120px" })

                </div>
            </div>


        </div>
        <br />

        <p class="margin-top-05">


            <button type="submit" class="btn btn-primary btn-sm">
                <span class="glyphicon glyphicon-search"></span> Tìm kiếm
            </button>

            @Html.NoEncodeActionLink("<span class='glyphicon glyphicon-plus'></span> Thêm mới", "Thêm mới", "Create", "GPS_SatHach", null, htmlAttributes: new { @class = "btn btn-primary btn-sm" })

            <button type="submit" class="btn btn-primary btn-sm" name="SearchButton" value="Xuất Excel">
                <i class='fa fa-file-excel-o'></i> Xuất Excel
            </button>

            @Html.NoEncodeActionLink("<i class='fa fa-file-excel-o'></i> Import Excel", "Import Excel", "ImportExcel", "GPS_SatHach", null, htmlAttributes: new { @class = "btn btn-primary btn-sm" })


        </p>
    }
    <br />

    <fieldset class="fdb-scheduler-border">
        <legend class="fdb-scheduler-search-border">Kết quả tìm kiếm</legend>

        <label id="lblMessageTotal" style="color:blue; font-weight:bold">Tổng số bản ghi: @ViewBag.TotalRow</label> &nbsp;&nbsp;&nbsp;

        <table class="table table-hover table-bordered table-condensed">
            <tr>
                <th>
                    Mã kỳ sát hạch
                </th>
                <th>
                    Đơn vị đào tạo
                </th>
                <th>
                    Ngày sát hạch
                </th>
                <th>
                    Giờ sát hạch
                </th>
                <th>
                    Số quyết định sát hạch
                </th>
                <th>
                    Ngày quyết định sát hạch
                </th>
                <th>
                    Chủ tịch hội đồng sát hạch
                </th>

                <th>
                    Trạng thái
                </th>
                <th></th>
            </tr>
            @{
                if (Model.SearchResults != null)
                {
                    foreach (var item in Model.SearchResults)
                    {
                        <tr>
                            <td>
                                @Html.DisplayFor(modelItem => item.SH_MA)
                            </td>
                            <td>
                                @Html.DisplayFor(modelItem => (item.SH_DVGTVT_MA))
                            </td>
                          
                            <td>
                                @Html.DisplayFor(modelItem => item.SH_NGAY)
                            </td>
                            <td>
                                @Html.DisplayFor(modelItem => item.SH_GIO)
                            </td>
                            <td>
                                @Html.DisplayFor(modelItem => item.SH_SOQD)
                            </td>
                            <td>
                                @Html.DisplayFor(modelItem => item.SH_NGAYQD)
                            </td>

                            <td>
                                @Html.DisplayFor(modelItem => item.SH_CT_HDSH)
                            </td>
                            <td>
                                @Html.DisplayFor(modelItem => item.SH_ACTIVE)
                            </td>
                            <td>
                                <div class="pull-right">

                                    <a href="@Url.Action("Edit", "GPS_SatHach", new { id1 = System.Uri.EscapeDataString(item.SH_MA), id2 = System.Uri.EscapeDataString(item.SH_DVGTVT_MA) })">
                                        <img src="@Url.Content("~/fonts/grid-edit-icon.png")" title="Sửa" />
                                    </a>

                                    <a href="@Url.Action("Delete", "GPS_SatHach", new { id1 = item.SH_MA, id2 = item.SH_DVGTVT_MA })" delete-modal="">
                                        <img src="@Url.Content("~/fonts/grid-delete-icon1.gif")" title="Hủy giảng viên" />
                                    </a>
                                </div>
                            </td>
                        </tr>
                    }
                }
            }

        </table>
    </fieldset>

    <div class="pagination-sm">
        @Html.PagedListPager(Model.SearchResults, page => Url.Action("Index", new
   {
       page,
       Model.pSH_MA,
       Model.pSH_DVGTVT_MA,
       Model.pSH_SOQD,
       Model.pSH_NGAY_TU,
       Model.pSH_NGAY_DEN
   }))
    </div>
</div>


<!-- delete modal placeholder-->
<div id='deleteModal' class='modal fade in'>
    <div class="modal-dialog">
        <div class="modal-content">
            <div id='deleteModalContent'></div>
        </div>
    </div>
</div>

<!-- modal placeholder-->
<div id='myModal' class='modal fade in'>
    <div class="modal-dialog">
        <div class="modal-content">
            <div id='myModalContent'></div>
        </div>
    </div>
</div>

@section Scripts {
    @Scripts.Render("~/bundles/modalform")
}

<script src="~/Scripts/jquery-ui-1.11.4.js"></script>
<script src="//code.jquery.com/ui/1.11.2/jquery-ui.js" type="text/javascript"></script>
<script src="~/Scripts/datepicker.js"></script>
<script src="~/Scripts/jquery-ui-1.11.4.js"></script>
<script src="~/Scripts/jquery.maskedinput.js"></script>
<script src="~/Scripts/jquery.maskMoney.js"></script>
<script src="~/Scripts/jquery.number.js"></script>
<script src="~/Scripts/jquery.masknumber.js"></script>
<script type="text/javascript">

    $("#pSH_NGAY_TU").datepicker({
        changeMonth: true,
        changeYear: true,

        dateFormat: 'dd/mm/yy'
    });
    $("#pSH_NGAY_TU").mask("99/99/9999", { placeholder: "dd/mm/yyyy" });

    $("#pSH_NGAY_DEN").datepicker({
        changeMonth: true,
        changeYear: true,

        dateFormat: 'dd/mm/yy'
    });
    $("#pSH_NGAY_DEN").mask("99/99/9999", { placeholder: "dd/mm/yyyy" });


    $(function () {
        $(document).tooltip();
    });

</script>